package com.powernode.mapper;

import com.powernode.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author 繁寂
 * @version 1.0
 * @since 1.0
 */
@Mapper
public interface UserMapper {

    @Select("select * from t_user")
    @Result(property = "userName", column = "user_name")
    List<User> selectUserAll();

    @Select("select * from t_user where id=#{id}")
    @Result(property = "userName", column = "user_name")
    List<User> selectUser(User user);

    @Insert("insert into t_user value(null, #{name}, #{age}, #{sex}, #{userName}, #{password})")
    Integer insertUser(User user);

    @Update("update t_user set name=#{name}, age=#{age}, sex=#{sex}, user_name=#{userName}, password=#{password} where id=#{id} ")
    Integer updateUser(User user);


    @Delete("delete from t_user where id=#{id}")
    Integer deleteUser(User user);

}
